package net.alan.modules.repository;

import net.alan.modules.bean.Favorite;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * Author 李岩飞
 * Email eliyanfei@126.com
 * 2017/11/22
 */
public interface FavoriteRepository extends JpaRepository<Favorite, Integer> {
    /**
     * 通过用户Id获取收藏信息
     * @param userId
     * @param pageable
     * @return
     */
    public Page<Favorite> findByUserId(Integer userId, Pageable pageable);
    public List<Favorite> findByUserId(Integer userId);
    /**
     * 通过用户Id获取收藏信息
     * @param catalogId
     * @param pageable
     * @return
     */
    public Page<Favorite> findByCatalogId(Integer catalogId, Pageable pageable);


    Integer countByCatalogId(Integer catalogId);
}
